#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000+10;
const int INF = 0x3f3f3f3f;
int x[maxn], y[maxn], N;
double dp[maxn][maxn];

inline double dist(int i, int j){
    return sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
}

double DP(int i, int j){
    double& ans = dp[i][j];
    if(ans > 0) return ans;
    if(i == N-1) return ans = dist(i, N) + dist(j, N);
    ans = INF;
    int k = max(i,j)+1;
    ans = min(ans, DP(k, j) + dist(i, k));
    ans = min(ans, DP(k, i) + dist(j, k));
    return ans;
}
int main() {
//    ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);
    while(cin >> N){
        memset(dp, 0, sizeof(dp));
        for (int i = 1; i <= N; ++i) {
            cin >> x[i] >> y[i];
        }
        DP(2, 1);
        printf("%.2f\n", dp[2][1] + dist(1, 2));
    }
    return 0;
}